#include "fxcc/imgui/Editor.h"
#include "fxcc/core/graph/common/LightData.h"

using namespace fxcc::graph::common;
using namespace fxcc::imgui;

template <>
bool Editor::Edit<LightData::EffectData>(const std::string& label, LightData::EffectData& inst)
{
	bool flag{ 0 };

	static std::map<LightData::EffectData::Type, std::string> ls=
	{
		{LightData::EffectData::Type::_LightData_directioon,"_LightData_directioon"},
		{LightData::EffectData::Type::_LightData_point,"_LightData_point"},
		{LightData::EffectData::Type::_LightData_spot,"_LightData_spot"},
		{LightData::EffectData::Type::_LightData_ambient,"_LightData_ambient"},
		{LightData::EffectData::Type::_LightData_area,"_LightData_area"},
	};
	ComboEnumMap<LightData::EffectData::Type>("Type", inst.m_Type, ls);

	flag|=EditInst<float>( "m_AttenuationConstant", inst.m_AttenuationConstant);
	flag|=EditInst<float>( "m_AttenuationLinear", inst.m_AttenuationLinear);
	flag|=EditInst<float>( "m_AttenuationQuadratic", inst.m_AttenuationQuadratic);
	flag|=DragInst<float>( "m_AngleInnerCone", inst.m_AngleOuterCone);
	flag|=DragInst<float>( "m_AngleOuterCone", inst.m_AngleInnerCone);
	flag|=EditInst<glm::vec2>("m_Size", inst.m_Size);

	flag |= ColorInst<glm::vec3>("m_ColorDiffuse", inst.m_ColorDiffuse);
	flag |= ColorInst<glm::vec3>("m_ColorSpecular", inst.m_ColorSpecular);
	flag |= ColorInst<glm::vec3>("m_ColorAmbient", inst.m_ColorAmbient);
	flag |= EditInst<glm::vec3>("m_PbrColor", inst.m_PbrColor);
	flag |= EditInst<float>("m_PbrLightStrength", inst.m_PbrLightStrength);
	return flag;
}

template <>
bool Editor::Edit<LightData>(const std::string &label, LightData &inst)
{
	bool flag{ 0 };
	flag |= EditInst<std::string>("m_Name", inst.m_Name);
	flag |= EditInst<LightData::EffectData>("m_EffectData", inst.m_EffectData);
	return flag;
}
